// subpages1/protectRight/protectRight.js
const app = getApp();
Page({

  data: {
    pageData:{id:0},  //页面参数，维权id
    rightInfo:{},     //维权信息
  },

  onLoad: function (options) {
    this.setData({"pageData.id":options.id});
    this.getList();
  },

  onShow: function () {

  },
  // 拉取维权信息
  getList(){
    let that = this;
    wx.showToast({
      title: '加载中',
      icon: 'loading',
      mask: true,
      duration: 10000
    });
    wx.request({
      url: app.globalData.requestUrl+`&map=applet_single_refund_record&id=${this.data.pageData.id}`,
      method:"GET",
      success(res){
        if (res.data.ec == 200) {       
          // res.data.data.tr_goods_data.forEach(v=>{
          //   let total = 0;
          //   v.ticket_info.forEach(k=>{
          //     total+=Number(k.cr_ticket_price);
          //   })
          //   v.subTotal = total.toFixed(2);   //小计
          //   v.cover = v.cover.includes("http")? v.cover : "http://shopping.zhjl.link"+v.cover;
          // })
          that.setData({
            rightInfo: res.data.data
          })
        } else {
          wx.showModal({
            title: '提示',
            content: res.data.em,
            showCancel: false
          });
        }
      },
      complete: function () {
        wx.hideToast();
      }
    })
  },
})